package MovieGuessingGame.login;

import javax.net.ssl.SSLServerSocket;
import javax.net.ssl.SSLServerSocketFactory;
import javax.net.ssl.SSLSocket;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

class ServerSSL {
	
	BufferedReader bufferedreader = null;
	SSLServerSocket sslserversocket = null;
	SSLSocket sslsocket = null;
	String userName = null;
	String password = null;
	
	void init() throws IOException{
		
	
		SSLServerSocketFactory sslserversocketfactory = (SSLServerSocketFactory) SSLServerSocketFactory
				.getDefault();
		sslserversocket = (SSLServerSocket) sslserversocketfactory
				.createServerSocket(9999);
		System.out.println("Server Socket created");
		for (;;){
			ServerSSLWorker  worker = new ServerSSLWorker(this,(SSLSocket)sslserversocket.accept());
			worker.start();
			System.out.println("created worker");
			
		}
	}


	public static void main(String[] arstring) {
		try {

			ServerSSL server = new ServerSSL();
			server.init();

		} catch (Exception exception) {
			exception.printStackTrace();
		}
	}
}